package com.v9.system.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

/**
 * 角色和菜单关联 sys_role_menu
 *
 * @author shilun
 */
@Data
@Accessors(chain = true)
@TableName(value = "sys_role_menu", common = "角色菜单")
public class RoleMenu {
    /**
     * 角色ID
     */
    @TableField(common = "权限id")
    private Long roleId;

    /**
     * 菜单ID
     */
    @TableField(common = "菜单id")
    private Long menuId;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }

        if (!(o instanceof RoleMenu roleMenu)) {
            return false;
        }

        return new EqualsBuilder().append(roleId, roleMenu.roleId).append(menuId, roleMenu.menuId).isEquals();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder(17, 37).append(roleId).append(menuId).toHashCode();
    }
}
